local skel = fk.CreateSkill {
  name = "lb_old__jiyu",
}

Fk:loadTranslationTable {
  ["lb_old__jiyu"] = "疾雨",
  [":lb_old__jiyu"] = "每回合限一次，当你使用【杀】指定唯一目标后，若你本回合未对其使用过【杀】，你可以观看其手牌并选择一项：<br>" ..
      "1.此【杀】额外结算一次；<br>" ..
      "2.本回合此技能及【杀】的使用次数+1。",

  ["#lb_old__jiyu-1"] = "【杀】额外结算一次",
  ["#lb_old__jiyu-2"] = "〖疾雨〗及【杀】的使用次数+1",
  ["#lb_old__jiyu"] = "疾雨：你可以观看 %dest 的手牌并选择一项：1.此【杀】额外结算一次；2.本回合〖疾雨〗及【杀】的使用次数+1",
  ["#lb_old__jiyu-view"] = "疾雨：观看 %dest 的手牌并选择一项",

  ["$lb_old__jiyu1"] = "生死虚实，一念之间。",
  ["$lb_old__jiyu2"] = "洞天幻化，长梦一觉…",
  ["$lb_old__jiyu3"] = "就是现在！",
}

skel:addEffect(fk.TargetSpecified, {
  anim_type = "offensive",
  can_trigger = function(self, event, target, player, data)
    if player:hasSkill(skel.name) and data.card.trueName == "slash" and target == player and
        data:isOnlyTarget(data.to) and (player:usedSkillTimes(skel.name) <= player:getMark("lb_old__jiyu-turn")) then
      local t = data.to
      return not t:isKongcheng() and #player.room.logic:getEventsOfScope(GameEvent.UseCard, 2, function(e)
        local use = e.data
        return use.card.trueName == "slash" and use.from == player and table.contains(use.tos, t)
      end, Player.HistoryTurn) == 1
    end
  end,
  on_cost = function(self, event, target, player, data)
    return player.room:askToSkillInvoke(player, { skill_name = skel.name, prompt = "#lb_old__jiyu::" .. data.to.id, })
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local to = data.to
    if room:askToViewCardsAndChoice(player, {
          cards = to:getCardIds("h"),
          skill_name = skel.name,
          prompt = "#lb_old__jiyu-view::" .. to.id,
          choices = { "#lb_old__jiyu-1", "#lb_old__jiyu-2" },
          min_num = 1,
          max_num = 1,
        }) == "#lb_old__jiyu-1" then
      data.use.additionalEffect = (data.use.additionalEffect or 0) + 1
    else
      room:addPlayerMark(player, "lb_old__jiyu-turn")
      room:addPlayerMark(player, MarkEnum.SlashResidue .. "-turn")
    end
  end,
})

return skel
